<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h3>详情页 --- <span id="title"></span></h3>

  <script>
    const title = document.getElementById("title");
    window.onmessage = function (e) {  // 接收父级页面传过来的数据
      // console.log(e.data);
      title.innerText = e.data.age;
      e.source.postMessage("阿杰 20了", e.origin)  // 向父级页面发送消息
    }
  </script>
</body>

</html>